#include "command.hpp"

extern Log lg;

int main()
{
    int shmid = GetShm();
    char* shmaddr = (char*)shmat(shmid, nullptr, 0);

    int fd = open(FIFO_FILE, O_WRONLY);
    if (fd < 0)
    {
        lg(Fatal, "error string: %s, error code: %d", strerror(errno), errno);
        exit(FIFO_OPEN_ERR);
    }
    
    while(true)
    {
        cout << "Please cin : ";
        fgets(shmaddr, 4096, stdin);
        
        write(fd, "c", 1);// 通知对方
    }

    shmdt(shmaddr);
    close(fd);

    return 0;
}